{% extends 'layout.html.twig' %}

{% block title %}{% if pageNav == 'teach' %}{{'user.homepage.teaching_courses'|trans}} - {% elseif pageNav == 'learn' %}{{'user.homepage.learning_courses'|trans}} - {% elseif pageNav == 'favorited' %}{{'user.homepage.favorite_courses'|trans}} - {% elseif pageNav == 'group' %}{{'user.homepage.joined_group'|trans}} - {% elseif pageNav == 'friend' %}{{'user.homepage.following_fan'|trans}} - {% else %}{{''}}{% endif %}{% if user.destroyed|default(0) == 0 %}{{'user.homepage'|trans({'%nickname%':user.nickname})}}{% else %}{{ 'user.user_had_destroyed'|trans }}{% endif %} - {{ parent() }}{% endblock %}
{% block keywords %}{{ user.title }}{% endblock %}
{% block description %}{{ user.about|default('')|plain_text(100) }}{% endblock %}
{% set bodyClass = 'userpage bg-blank' %}
{% set pageNav = pageNav|default(null) %}

{% do script(['libs/jquery-blurr.js','app/js/user/index.js']) %}

{% block top_content %}
  {{ render(controller('AppBundle:User:headerBlock', {user:user})) }}
{% endblock %}

{% block content %}
  {% if not user.destroyed|default(0) %}
  <ul class="nav nav-tabs clearfix">
    <li {% if pageNav == 'about' %}class="active"{% endif %}><a href="{{ path('user_about', {id: user.id}) }}">{{'user.homepage.introductions'|trans}}</a></li>
  	{% if 'ROLE_TEACHER' in user.roles %}
	    <li {% if pageNav == 'teach' %}class="active"{% endif %}><a href="{{ path('user_teach', {id: user.id}) }}">{{'user.homepage.teaching_courses'|trans}}</a></li>
    {% endif %}

    {% if 'ROLE_TEACHER' in user.roles %}
      <li {% if pageNav == 'teaching' %}class="active"{% endif %}><a href="{{ path('user_teaching_classrooms', {id:user.id}) }}">{{'user.homepage.teaching_classrooms'|trans({'%classroomName%':setting('classroom.name')|default('classroom'|trans)})}}</a></li>
    {% endif %}
    <li {% if pageNav == 'learn' %}class="active"{% endif %}><a href="{{ path('user_learn', {id:user.id}) }}">{{'user.homepage.learning_courses'|trans}}</a></li>
    <li {% if pageNav == 'learning' %}class="active"{% endif %}><a href="{{ path('user_learning_classrooms', {id:user.id}) }}">{{'user.homepage.learning_classrooms'|trans({'%classroomName%':setting('classroom.name')|default('classroom'|trans)})}}</a></li>


    <li {% if pageNav == 'favorited' %}class="active"{% endif %}><a href="{{ path('user_favorited', {id:user.id}) }}">{{'user.homepage.favorite_courses'|trans}}</a></li>
    <li {% if pageNav == 'group' %}class="active"{% endif %}><a href="{{path('user_group',{id:user.id})}}">{{'user.homepage.joined_group'|trans}}</a></li>
    <li {% if pageNav == 'friend' %}class="active"{% endif %}><a href="{{ path('user_following', {id:user.id}) }}">{{'user.homepage.following_fan'|trans}}</a></li>
  </ul>
  {% block main %}{% endblock %}
  {% endif %}
{% endblock %}
